#include <bits/stdc++.h>
#define lowbit(x) (x & -x)
using namespace std;
const int MAX = 5e5 + 10;

int n, m;
int s[MAX];

void insert(int index, int val) {
	while (index <= n) {
		s[index] += val;
		index += lowbit(index);
	}
	return;
}

int query(int index) {
	int res = 0;
	while (index != 0) {
		res += s[index];
		index -= lowbit(index);
	}
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		int num;
		cin >> num;
		insert(i, num);
	}
	for (int i = 1; i <= m; ++i) {
		int type;
		int a, b;
		cin >> type >> a >> b;
		if (type == 1) {
			insert(a, b);
		} else {
			int res = query(b) - query(a - 1);
			cout << res << endl;
		}
	}
	return 0;
}